<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>쿠키 불러오기 p204</h1>
	<p>전에 만든 쿠키시간이 지난 뒤에 새로고침하면 값이 나오지 않음</p>
<%
	String name="", value="";
	String cookie=request.getHeader("Cookie");
	if(cookie!=null){
		Cookie cookies[] = request.getCookies();
		for(int i=0; i<cookies.length ; i++){
			if(cookies[i].getName().equals("name")){
				name = cookies[i].getName();
				value = cookies[i].getValue();
			}
		}
	}

%>

<h2>쿠키 이름 = <%=name %></h2>
<h2>쿠키 값 = <%=value %></h2>
</body>
</html>